In the field of information technology, speeds of microprocessors and communication networks have been improving. Therefore, with application of the technology to a PLC, a period of an execution cycle of a control program has been shortening. Accordingly, it is becoming advantageous to make constant, with a high degree of precision, a period of control data (input data and output data) communication performed between a CPU unit of the PLC and other units.
When the period of control data communication within the PLC is constant, it becomes easier to make a period for updating an output signal constant, the output signal being provided to an external device from the I/O unit. Thus, it also becomes easier for an external device to perform an operation in synchronization with a period of a control cycle of the PLC.
Furthermore, when the period of control data communication is constant, it becomes possible for a remote I/O terminal to perform a precisely time-controlled scheduled operation, such as obtaining input data from outside just before a scheduled time to transmit input data to the CPU unit, the remote I/O terminal communicating with the CPU unit via a field network. Thereby, the CPU unit can perform calculation processing using newest obtainable input data. Therefore, in conjunction with the shortened period of the control cycle, response time from obtaining input data to transmission of output data can be shortened, the output data being a result of calculation using the input data.
Furthermore, when the period of control data communication is constant, any one of the units in the PLC can promptly determine that a communication abnormality has occurred by detecting that the communication has not been carried out at a planned time.
In addition, when direct communication is carried out via the field network between the CPU unit and a controlled device outside of the PLC, such as a servo motor driver, the period of control data communication via the field network can be made constant, which is advantageous. Since it is becoming possible to shorten the period of the execution cycle of the PLC such that the period of the execution cycle of the PLC can be used as a control period of a servo motor, the CPU unit of the PLC can also control a motor by generating and outputting an instruction value to the servo motor driver for each execution cycle without a separate specialized motion controller. However, in such a case, it is important that the CPU unit be able to transmit an output signal at a constant period in order to control the motor with a high degree of precision.
Furthermore, the technical scope of the CPU unit of the PLC according to the present disclosure is not limited to a function of a conventional CPU unit which carries out control mainly by executing a sequence program, but also includes a CPU unit having an extended function, such as an added function of a motion controller.
Moreover, time required to execute a control program (a sequence program, a motion calculation program, and the like) may be different each time execution of the control program is repeated. A distribution of this execution time often shows a tendency in which the execution time is relatively short and has low variation in most cases of execution, while a small number of cases have a relatively long execution time.
The execution time has such a distribution because execution sometimes includes processing that is performed by the control program only when a specific condition is satisfied. In a cycle in which such a condition is satisfied, a greater amount of processing is performed than processing in other cycles, and thus execution time becomes longer. Examples of a case having a longer execution time includes a case in which initial processing is performed for many axes in a cycle satisfying a starting condition of a motion command, such as a motion function block used in a sequence program (user program). This initial processing includes processing to calculate a motion instruction value in each cycle in or after the cycle satisfying the starting condition of the motion command.
In the constant period system for the execution cycle as shown in Patent Literature 1 (Japanese Patent Laid-Open Publication No. 2000-105604), the communication period can only be constant when the period of the execution cycle is set longer than a maximum execution time of the control program.
However, when the period of the execution cycle is set to be longer than the maximum execution time of the control program, a short execution cycle period suitable for a short execution time cannot be attained even when the control program completes execution in a shorter time in most of the cycles.
Considering sporadic long execution times of the control program, the present disclosure aims to provide a CPU unit of a PLC which can set a period of communication for output and input of control data by the CPU unit of the PLC to be a constant period shorter than a maximum execution time of the control program.